import "package:ct_pa_majordomo/pages/residents/reserve.dart";
import "package:ct_pa_majordomo/pages/residents/residents.dart";
import "package:ct_pa_majordomo/pages/widgets/page_view_switcher.dart";
import "package:flutter/material.dart";

class ResidentsLayout extends StatefulWidget {
  const ResidentsLayout({super.key});

  @override
  ResidentsLayoutState createState() => ResidentsLayoutState();
}

class ResidentsLayoutState extends State<ResidentsLayout> {
  // 页面引用
  final GlobalKey<ResidentsState> _residentsKey = GlobalKey<ResidentsState>();
  
  // 添加刷新方法，供外部调用
  void refresh() {
    if (_residentsKey.currentState != null) {
      _residentsKey.currentState!.refresh();
    }
  }
  
  @override
  Widget build(BuildContext context) {
    return PageViewSwitcher(
      items: const ["入住人"],
      children: [Residents(key: _residentsKey)],
    );
  }
}
